package cn.zust.ly.EyExample.Ez48;

import java.util.Scanner;
public class Test {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();	//Num of point
        int m = scan.nextInt(); //Num of edge

        int[][] num = new int[n][m]; //matrix
        int fromPoint=0, toPoint=0;

        for(int i=0 ; i<m ; i++) {
            fromPoint = scan.nextInt();
            toPoint = scan.nextInt();
            num[fromPoint-1][i] = 1;
            num[toPoint-1][i] = -1;
        }

        for(int i=0 ; i<n ; i++) {
            for(int j=0 ; j<m ; j++) {
                System.out.print(num[i][j] + " ");
            }
            System.out.println();
        }
    }
}